import { functionCommon, requestCommon } from "@whzhuke/common"

export default {
  list: (params: any = {}) => {
    const { pageNum, ...rest } = params
    return requestCommon.get<any>({
      url: `${functionCommon.requestHost("api")}/v1/api/companies/`,
      params: {
        ...rest,
        pageNum: typeof pageNum === "number" ? pageNum + 1 : pageNum ?? 1
      }
    })
  },//查询供应商分页列表
  save: (params: any) => {
    return requestCommon.postJson<any>({
      url: `${functionCommon.requestHost("api")}/v1/api/companies/`,
      params
    })
  },//保存供应商
   edit: (params: any) => {
    return requestCommon.put<any>({
      url: `${functionCommon.requestHost("api")}/v1/api/companies/`,
      params
    })
  },//修改供应商
   del: (params: any) => {
    return requestCommon.del<any>({
      url: `${functionCommon.requestHost("api")}/v1/api/companies/${params.id}`,
      params
    })
  },//删除供应商
  item: (params: any) => {
    return requestCommon.get<any>({
      url: `${functionCommon.requestHost("api")}/v1/api/companies/${params.id}`
    })
  }//查询供应商详情



}
